<template>
  <div>
    <el-container>
      <el-header>
        <div class="firstSytle">
          <el-button size="mini" type="success" @click="initData" icon="el-icon-refresh">刷新
          </el-button>
          <!-- <el-button size="mini" type="primary" @click="add"   icon="el-icon-circle-plus-outline">添加
          </el-button> -->
          <el-button size="mini" type="danger" @click="deleteBatch" icon="el-icon-delete">删除
          </el-button>
          <el-button size="mini" type="primary" @click="checkTable">卫生评价</el-button>
        </div>
      </el-header>

      <el-main style="padding-left: 1px;padding-top: 20px;height:100%">
        <div>
          <el-table :data="sanitarys" stripe v-loading="tableLoading" size="mini" style="width: 100%;"
                    @selection-change="selectDel">
            <el-table-column type="selection" width="30"></el-table-column>
            <el-table-column prop="listId" label="序号" width="60px" align="center"></el-table-column>
            <el-table-column prop="buildId" label="公寓编号" width="120px" align="center"></el-table-column>
            <el-table-column prop="roomId" label="宿舍号" align="center"></el-table-column>
            <el-table-column prop="ground" label="地面卫生" align="center"></el-table-column>
            <el-table-column prop="bed" label="床铺卫生" align="center"></el-table-column>
            <el-table-column prop="balcony" label="阳台卫生" align="center"></el-table-column>
            <el-table-column prop="desk" label="书桌卫生" align="center"></el-table-column>
            <el-table-column prop="electricity" label="用电安全" align="center"></el-table-column>
            <el-table-column prop="checkScore" label="综合评价" align="center"></el-table-column>
            <el-table-column prop="uname" label="检查人" align="center"></el-table-column>
            <el-table-column prop="checkTime" label="检查时间" align="center" width="180px"></el-table-column>
            <el-table-column label="操作" align="center" width="200px"> 
              <template slot-scope="scope">
                <el-button type="primary" icon="el-icon-edit" size="mini" @click="details(scope.row)"></el-button>
                <el-button type="danger" icon="el-icon-delete" size="mini" @click="deleteId(scope.row)"></el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="lastLine" style="margin-top: 10px">               
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                           :current-page.sync="pageNum" :page-sizes="[10, 20,30,50,100,200,]"
                           :page-size="pageSize"
                           layout="sizes, prev, pager, next" :total="total">      
            </el-pagination>
          </div>
        </div>
      </el-main>
    </el-container>

    <el-dialog title="点我干嘛" :visible.sync="clickbutton" width="30%">
      <div class="check11">
        <el-col :span="4">
          <div>
            <el-select v-model="checkForm.buildId" placeholder="请选择楼号" size=small style="width:90%;padding-top:3px">
              <el-option v-for="item in selectBulid" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
            <el-select v-model="checkForm.roomId" placeholder="请选择宿舍" size=small style="width:90%;padding-top:3px">
              <el-option v-for="item in selectRoom" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </div>
        </el-col>
        <el-col :span="20">
          <div class="topCenter">
            <div>评价</div>
          </div>
        </el-col>
        <el-col :span="2">
          <div>
            <p>评分</p>
          </div>
        </el-col>
      </div>
      <el-form :model="checkForm" label-width="15.5%">
        <el-form-item label="地面卫生" id="Check">
          <div class="check12">
            <div class="checkCenter">
              <el-radio-group v-model="checkForm.ground" size="small" @change="updataGroundGrade">
                <el-radio-button label="1">好</el-radio-button>
                <el-radio-button label="2">较好</el-radio-button>
                <el-radio-button label="3">一般</el-radio-button>
                <el-radio-button label="4">差</el-radio-button>
              </el-radio-group>
            </div>
            <div class="checkInput">
              <div>{{this.groundGrade}}</div>
            </div>
          </div>
        </el-form-item>

        <el-form-item label="床铺卫生" id="Check">
          <div class="check12">
            <div class="checkCenter">
              <el-radio-group v-model="checkForm.bed" size="small" @change="updataBedGrade">
                <el-radio-button label="1">好</el-radio-button>
                <el-radio-button label="2">较好</el-radio-button>
                <el-radio-button label="3">一般</el-radio-button>
                <el-radio-button label="4">差</el-radio-button>
              </el-radio-group>
            </div>
            <div class="checkInput">
              <div>{{this.bedGrade}}</div>
            </div>
          </div>

        </el-form-item>
        <el-form-item label="阳台卫生" id="Check">
          <div class="check12">
            <div class="checkCenter">
              <el-radio-group v-model="checkForm.balcony" size="small" @change="updataBalconyGrade">
                <el-radio-button label="1">好</el-radio-button>
                <el-radio-button label="2">较好</el-radio-button>
                <el-radio-button label="3">一般</el-radio-button>
                <el-radio-button label="4">差</el-radio-button>
              </el-radio-group>
            </div>
            <div class="checkInput">
              <div>{{this.balconyGrade}}</div>
            </div>
          </div>
        </el-form-item>
        <el-form-item label="书桌卫生" id="Check">
          <div class="check12">
            <div class="checkCenter">
              <el-radio-group v-model="checkForm.desk" size="small" @change="updataDeskGrade">
                <el-radio-button label="1">好</el-radio-button>
                <el-radio-button label="2">较好</el-radio-button>
                <el-radio-button label="3">一般</el-radio-button>
                <el-radio-button label="4">差</el-radio-button>
              </el-radio-group>
            </div>
            <div class="checkInput">
              <div>{{this.deskGrade}}</div>
            </div>
          </div>
        </el-form-item>
        <el-form-item label="用电安全" id="Check">
          <div class="check12">
            <div class="checkCenter">
              <el-radio-group v-model="checkForm.electricity" size="small" @change="updataEleGrade">
                <el-radio-button label="1">好</el-radio-button>
                <el-radio-button label="2">较好</el-radio-button>
                <el-radio-button label="3">一般</el-radio-button>
                <el-radio-button label="4">差</el-radio-button>
              </el-radio-group>
            </div>
            <div class="checkInput">
              <div>{{this.eleGrade}}</div>
            </div>
          </div>
        </el-form-item>
        <el-form-item label="综合评价" id="Check">
          <!-- <el-input size="small" style="width:88%"></el-input> -->
          <div class="score">{{this.checkForm.checkScore}}</div>
        </el-form-item>
        <el-form-item label="整体整改" id="Check">
          <el-checkbox-group v-model="checkForm.allSelect" size="small">
            <el-checkbox label="地面卫生" border></el-checkbox>
            <el-checkbox label="床铺卫生" border></el-checkbox>
            <el-checkbox label="阳台卫生" border></el-checkbox>
            <el-checkbox label="书桌卫生" border></el-checkbox>
            <el-checkbox label="用电安全" border></el-checkbox>
          </el-checkbox-group>
        </el-form-item>
      </el-form>
      <div slot="footer">            
        <el-button type="primary" size="mini" @click="annulment">取 消</el-button>
        <el-button type="primary" size="mini" @click="sureCheck()">确 认</el-button>
      </div>
    </el-dialog>

    <el-dialog title="添加" :visible.sync="clickAddButton" width="30%">
      <el-form :model="addSanitary" label-width="100px" :rules="rules" ref="rulesForm">
        <el-form-item label="公寓编号: " prop="buildId">
          <el-select v-model="addSanitary.buildId" style="width:100%;">
            <el-option v-for="item in selectBulid" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="宿舍号: " prop="roomId">
          <el-select v-model="addSanitary.roomId" style="width:100%;">
            <el-option v-for="item in selectRoom" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="卫生描述: " prop="content">
          <el-input v-model="addSanitary.content"></el-input>
        </el-form-item>

        <el-form-item label="检查分数: " prop="grade">
          <el-input v-model="addSanitary.grade"></el-input>
        </el-form-item>
      </el-form>

      <div slot="footer">
        <el-button @click="clickAddButton=false">取 消</el-button>
        <el-button type="primary" @click="addOneSanitary('rulesForm')">确 定</el-button>
      </div>

    </el-dialog>
    <!-- 检查表格 -->
    <!-- 检查表格 -->
    <el-dialog width="56%" title="卫生评价" :visible.sync="checkTableClick" id="check">
      <div class="check11">
        <el-col :span="4">
          <div>
            <el-select v-model="checkForm.buildId" placeholder="请选择楼号" size=small style="width:90%;padding-top:3px">
              <el-option v-for="item in selectBulid" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
            <el-select v-model="checkForm.roomId" placeholder="请选择宿舍" size=small style="width:90%;padding-top:3px">
              <el-option v-for="item in selectRoom" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </div>
        </el-col>
        <el-col :span="20">
          <div class="topCenter">
            <div>评价</div>
          </div>
        </el-col>
        <el-col :span="2">
          <div>
            <p>评分</p>
          </div>
        </el-col>
      </div>
      <el-form :model="checkForm" label-width="15.5%">
        <el-form-item label="地面卫生" id="Check">
          <div class="check12">
            <div class="checkCenter">
              <el-radio-group v-model="checkForm.ground" size="small" @change="updataGroundGrade">
                <el-radio-button label="1">好</el-radio-button>
                <el-radio-button label="2">较好</el-radio-button>
                <el-radio-button label="3">一般</el-radio-button>
                <el-radio-button label="4">差</el-radio-button>
              </el-radio-group>
            </div>
            <div class="checkInput">
              <div>{{this.groundGrade}}</div>
            </div>
          </div>
        </el-form-item>

        <el-form-item label="床铺卫生" id="Check">
          <div class="check12">
            <div class="checkCenter">
              <el-radio-group v-model="checkForm.bed" size="small" @change="updataBedGrade">
                <el-radio-button label="1">好</el-radio-button>
                <el-radio-button label="2">较好</el-radio-button>
                <el-radio-button label="3">一般</el-radio-button>
                <el-radio-button label="4">差</el-radio-button>
              </el-radio-group>
            </div>
            <div class="checkInput">
              <div>{{this.bedGrade}}</div>
            </div>
          </div>

        </el-form-item>
        <el-form-item label="阳台卫生" id="Check">
          <div class="check12">
            <div class="checkCenter">
              <el-radio-group v-model="checkForm.balcony" size="small" @change="updataBalconyGrade">
                <el-radio-button label="1">好</el-radio-button>
                <el-radio-button label="2">较好</el-radio-button>
                <el-radio-button label="3">一般</el-radio-button>
                <el-radio-button label="4">差</el-radio-button>
              </el-radio-group>
            </div>
            <div class="checkInput">
              <div>{{this.balconyGrade}}</div>
            </div>
          </div>
        </el-form-item>
        <el-form-item label="书桌卫生" id="Check">
          <div class="check12">
            <div class="checkCenter">
              <el-radio-group v-model="checkForm.desk" size="small" @change="updataDeskGrade">
                <el-radio-button label="1">好</el-radio-button>
                <el-radio-button label="2">较好</el-radio-button>
                <el-radio-button label="3">一般</el-radio-button>
                <el-radio-button label="4">差</el-radio-button>
              </el-radio-group>
            </div>
            <div class="checkInput">
              <div>{{this.deskGrade}}</div>
            </div>
          </div>
        </el-form-item>
        <el-form-item label="用电安全" id="Check">
          <div class="check12">
            <div class="checkCenter">
              <el-radio-group v-model="checkForm.electricity" size="small" @change="updataEleGrade">
                <el-radio-button label="1">好</el-radio-button>
                <el-radio-button label="2">较好</el-radio-button>
                <el-radio-button label="3">一般</el-radio-button>
                <el-radio-button label="4">差</el-radio-button>
              </el-radio-group>
            </div>
            <div class="checkInput">
              <div>{{this.eleGrade}}</div>
            </div>
          </div>
        </el-form-item>
        <el-form-item label="综合评价" id="Check">
          <!-- <el-input size="small" style="width:88%"></el-input> -->
          <div class="score">{{this.checkForm.checkScore}}</div>
        </el-form-item>
        <el-form-item label="整体整改" id="Check">
          <el-checkbox-group v-model="checkForm.allSelect" size="small">
            <el-checkbox label="地面卫生" border></el-checkbox>
            <el-checkbox label="床铺卫生" border></el-checkbox>
            <el-checkbox label="阳台卫生" border></el-checkbox>
            <el-checkbox label="书桌卫生" border></el-checkbox>
            <el-checkbox label="用电安全" border></el-checkbox>
          </el-checkbox-group>
        </el-form-item>
      </el-form>
      <div slot="footer">            
        <el-button type="primary" size="mini" @click="annulment">取 消</el-button>
        <el-button type="primary" size="mini" @click="sureCheck()">确 认</el-button>
      </div>

    </el-dialog>

  </div>

</template>

<script>
    import {getRequest, postMethod, postRequest, putRequest} from "../../utils/api";

    export default {
        data() {
            return {
                addSanitary: {
                    id: '',
                    buildId: '',
                    uName: '',
                    roomId: '',
                    grade: '',
                    content: '',
                    checkTime: '',
                },
                sanitarys: [],
                tableLoading: false,
                clickbutton: false,
                clickAddButton: false,
                formSanitary: {
                    id: '',
                    buildId: '',
                    uName: '',
                    roomId: '',
                    grade: '',
                    content: '',
                    checkTime: '',
                },
                selectBulid: [ //楼号
                    {
                        label: '',
                        value: '',
                    }
                ],
                selectRoom: [ //宿舍号
                    {
                        label: '',
                        value: '',
                    }
                ],
                checkTableClick: false,
                checkForm: {
                    ground: '',
                    bed: '',
                    balcony: '',
                    desk: '',
                    electricity: '',
                    allSelect: [],
                    buildId: '',//楼号
                    roomId: '', //这是选择宿舍
                    checkScore: "0",//总分
                },
                groundGrade: "0",//地面卫生分数
                bedGrade: "0",//床铺卫生分数
                balconyGrade: "0",//阳台卫生分数
                deskGrade: "0",//书桌卫生分数
                eleGrade: "0",//用电安全分数

                tempBuildId: '',
                tempRoomId: '',
                pageNum: 1,
                pageSize: 10,
                total: 0,
                list: [],
                tableId: [],
                rules: {
                    buildId: [
                        {trigger: 'blur', message: '请输入公寓编号', required: true}
                    ],
                    roomId: [
                        {trigger: 'blur', message: '请输入宿舍号', required: true}
                    ],
                    content: [
                        {trigger: 'blur', message: '请输入卫生描述', required: true}
                    ],
                    grade: [
                        {trigger: 'blur', message: '请输入评分', required: true}
                    ]
                }
            };
        },
        methods: {
            updataGroundGrade(row) {   //地面
                // var arr ={"this.groundGrade":""}
                // for(var key in arr){
                //    this.getGrade(row,key)
                // }
                switch (row) {
                    case "1" :
                        this.groundGrade = "100";
                        break;
                    case "2" :
                        this.groundGrade = "90";
                        break;
                    case "3" :
                        this.groundGrade = "80";
                        break;
                    case "4" :
                        this.groundGrade = "60";
                        break;
                }
                this.checkForm.checkScore = this.groundGrade * 0.15 + this.bedGrade * 0.15 + this.balconyGrade * 0.15 + this.deskGrade * 0.15 + this.eleGrade * 0.4
            },
            updataBedGrade(row) {  //床铺
                switch (row) {
                    case "1" :
                        this.bedGrade = "100";
                        break;
                    case "2" :
                        this.bedGrade = "90";
                        break;
                    case "3" :
                        this.bedGrade = "80";
                        break;
                    case "4" :
                        this.bedGrade = "60";
                        break;
                }
                this.checkForm.checkScore = this.groundGrade * 0.15 + this.bedGrade * 0.15 + this.balconyGrade * 0.15 + this.deskGrade * 0.15 + this.eleGrade * 0.4
            },
            updataBalconyGrade(row) { //阳台
                switch (row) {
                    case "1" :
                        this.balconyGrade = "100";
                        break;
                    case "2" :
                        this.balconyGrade = "90";
                        break;
                    case "3" :
                        this.balconyGrade = "80";
                        break;
                    case "4" :
                        this.balconyGrade = "60";
                        break;
                }
                this.checkForm.checkScore = this.groundGrade * 0.15 + this.bedGrade * 0.15 + this.balconyGrade * 0.15 + this.deskGrade * 0.15 + this.eleGrade * 0.4
            },
            updataDeskGrade(row) { //书桌
                switch (row) {
                    case "1" :
                        this.deskGrade = "100";
                        break;
                    case "2" :
                        this.deskGrade = "90";
                        break;
                    case "3" :
                        this.deskGrade = "80";
                        break;
                    case "4" :
                        this.deskGrade = "60";
                        break;
                }
                this.checkForm.checkScore = this.groundGrade * 0.15 + this.bedGrade * 0.15 + this.balconyGrade * 0.15 + this.deskGrade * 0.15 + this.eleGrade * 0.4
            },
            updataEleGrade(row) { //用电
                switch (row) {
                    case "1" :
                        this.eleGrade = "100";
                        break;
                    case "2" :
                        this.eleGrade = "90";
                        break;
                    case "3" :
                        this.eleGrade = "80";
                        break;
                    case "4" :
                        this.eleGrade = "60";
                        break;
                }
                this.checkForm.checkScore = this.groundGrade * 0.15 + this.bedGrade * 0.15 + this.balconyGrade * 0.15 + this.deskGrade * 0.15 + this.eleGrade * 0.4
            },
            initData: function () {
                var tempdate
                this.tableLoading = true;
                // var _this = this;
                this.getRequest("/sanitary/findAll?pageSize=" + this.pageSize + "&pageNum=" + this.pageNum).then(resp => {
                    this.tableLoading = false;
                    console.log(resp)
                    if (resp && resp.status == 200) {
                        this.total = resp.data.obj.total;
                        this.sanitarys = resp.data.obj.data;
                        for (var i = 0; i < this.sanitarys.length; i++) {
                            let b;
                            b = i + 1
                            this.sanitarys[i].listId = b
                            tempdate = this.sanitarys[i].checkTime
                            this.sanitarys[i].checkTime = tempdate.slice(0, tempdate.indexOf("."))
                            switch (this.sanitarys[i].ground) {
                                case 1:
                                    this.sanitarys[i].ground = '100';
                                    break;
                                case 2:
                                    this.sanitarys[i].ground = '90';
                                    break;
                                case 3:
                                    this.sanitarys[i].ground = '80';
                                    break;
                                case 4:
                                    this.sanitarys[i].ground = '60';
                                    break;
                            }
                            switch (this.sanitarys[i].bed) {
                                case 1:
                                    this.sanitarys[i].bed = 100;
                                    break;
                                case 2:
                                    this.sanitarys[i].bed = 90;
                                    break;
                                case 3:
                                    this.sanitarys[i].bed = 80;
                                    break;
                                case 4:
                                    this.sanitarys[i].bed = 60;
                                    break;
                            }
                            switch (this.sanitarys[i].balcony) {
                                case 1:
                                    this.sanitarys[i].balcony = 100;
                                    break;
                                case 2:
                                    this.sanitarys[i].balcony = 90;
                                    break;
                                case 3:
                                    this.sanitarys[i].balcony = 80;
                                    break;
                                case 4:
                                    this.sanitarys[i].balcony = 60;
                                    break;
                            }

                            switch (this.sanitarys[i].desk) {
                                case 1:
                                    this.sanitarys[i].desk = 100;
                                    break;
                                case 2:
                                    this.sanitarys[i].desk = 90;
                                    break;
                                case 3:
                                    this.sanitarys[i].desk = 80;
                                    break;
                                case 4:
                                    this.sanitarys[i].desk = 60;
                                    break;
                            }
                            switch (this.sanitarys[i].electricity) {
                                case 1:
                                    this.sanitarys[i].electricity = 100;
                                    break;
                                case 2:
                                    this.sanitarys[i].electricity = 90;
                                    break;
                                case 3:
                                    this.sanitarys[i].electricity = 80;
                                    break;
                                case 4:
                                    this.sanitarys[i].electricity = 60;
                                    break;
                            }
                            switch (this.sanitarys[i].allSelect) {
                                case 1:
                                    this.sanitarys[i].allSelect = "";
                                    break;
                                case 2:
                                    this.sanitarys[i].allSelect = 90;
                                    break;
                                case 3:
                                    this.sanitarys[i].allSelect = 80;
                                    break;
                                case 4:
                                    this.sanitarys[i].allSelect = 60;
                                    break;
                            }
                        }

                    }
                })
            },
            loadEmpty() {
                this.tableLoading = true;
                this.getRequest("/sanitary/findAll?pageSize=" + this.pageSize + "&pageNum=" + this.pageNum).then(resp => {
                    this.tableLoading = false;

                    if (resp && resp.status == 200) {
                        this.total = resp.data.obj.total;
                        this.sanitarys = resp.data.obj.data;
                    }
                    this.clickAddButton = false;
                })
            },
            deleteId(row) {
                var roomId = row.roomId;
                this.tableLoading = true;
                this.deleteRequest("/sanitary/delBySaRoomId/" + roomId).then(resp => {
                    this.tableLoading = false;
                    if (resp && resp.status == 200) {
                        this.initData();
                        Message.success({message: data.data.msg});
                    }
                })
            },
            addOneSanitary(formName) {
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        var tempId, tempId2
                        tempId = this.addSanitary.buildId
                        this.addSanitary.buildId = this.getSelectLabel(this.selectBulid, tempId)
                        tempId2 = this.addSanitary.roomId
                        this.addSanitary.roomId = this.getSelectLabel(this.selectRoom, tempId2)
                        postMethod("/sanitary/add", this.addSanitary).then(resp => {
                            this.tableLoading = true;
                            if (resp && resp.status == 200) {
                                this.clearForms();
                                this.clickAddButton = false
                                this.loadEmpty();
                                Message.success({message: resp.data.msg});

                            } else {
                                Message.error({message: resp.data.msg});
                            }
                        })
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                })
            },
            getSelectLabel(selectList, tempListId) {
                for (var i = 0; i < selectList.length; i++) {
                    if (tempListId == selectList[i].value) {
                        return selectList[i].label
                    }
                }
            },
            details(row) {   //详情
                this.checkForm = row;
                this.clickbutton = true
            },
            add() {
                this.clickAddButton = true;
            },
            clearForms() {
                this.addSanitary = {
                    id: '',
                    buildId: '',
                    uName: '',
                    roomId: '',
                    grade: '',
                    content: '',
                    checkTime: '',
                }
            },
            UpdateSanitary() {//确认修改
                if (this.tempRoomId != "") {
                    this.tempRoomId = this.formSanitary.roomId
                    this.formSanitary.roomId = this.getSelectLabel(this.selectRoom, this.tempRoomId)
                }
                if (this.tempBuildId != "") {
                    this.tempBuildId = this.formSanitary.buildId
                    this.formSanitary.buildId = this.getSelectLabel(this.selectBulid, this.tempBuildId)
                }
                postMethod("/sanitary/update", this.formSanitary).then(resp => {
                    this.tableLoading = false;
                    if (resp && resp.status == 200) {
                        this.initData();
                        this.tempRoomId = "",
                            this.tempBuildId = "",
                            this.clickbutton = false;
                        Message.success({message: data.data.msg});
                    } else {
                        Message.error({message: data.data.msg});
                    }
                })
                this.clickbutton = false;
            },


            handleSizeChange(val) {    //分页
                this.pageSize = val;
                this.initData()
            },
            handleCurrentChange(val) {   //分页
                this.pageNum = val;
                this.initData()
            },
            getRoom() {    //获取宿舍号
                this.getRequest("/config/room").then(resp => {
                    this.tableLoading = false;
                    if (resp && resp.status == 200) {
                        var tempList = []
                        tempList = resp.data.obj
                        for (var i = 0; i < tempList.length; i++) {
                            this.selectRoom = tempList
                            this.selectRoom[i].label = tempList[i].roomId.toString()
                            this.selectRoom[i].value = tempList[i].roomId.toString()
                        }
                    }
                })
            },
            getBulid() {   //获取楼号
                this.getRequest("/config/build").then(resp => {
                    this.tableLoading = false;
                    if (resp && resp.status == 200) {
                        var tempList = []
                        tempList = resp.data.obj
                        for (var i = 0; i < tempList.length; i++) {
                            this.selectBulid = tempList
                            this.selectBulid[i].label = tempList[i].buildId.toString()
                            this.selectBulid[i].value = tempList[i].buildId.toString()
                        }
                    }
                })
            },
            handleBuild(row) {
                this.tempBuildId = row
            },
            handleRoom(row) {
                this.tempRoomId = row
            },
            deleteBatch() {
                if (this.tableId.length === 0) {
                    this.$message.error('请选择要删除的项目');
                    return false;
                }
                this.deleteRequest("/sanitary/deleteBatch/" + this.tableId).then(resp => {
                    this.tableLoading = false;
                    if (resp && resp.status == 200) {
                        this.initData();
                    }
                })
            },
            selectDel(row) {
                if (row.length != 0) {
                    for (var i = 0; i < row.length; i++) {
                        this.tableId[i] = row[i].id;
                    }
                    this.tableId = this.tableId.slice(0, row.length)
                } else if (row.length == 0) {
                    this.tableId = row
                }
            },
            checkTable() {
                this.checkTableClick = true;
            },
            sureCheck() {
                console.log(this.checkForm)
                postMethod("/sanitary/check", this.checkForm).then(resp => {
                    this.tableLoading = false;
                    if (resp && resp.status == 200) {
                        Message.success({message: data.data.msg});
                    } else {
                        Message.error({message: data.data.msg});
                    }
                })
                this.checkTableClick = false;
            },
            annulment() {
                this.checkForm.ground = '',
                    this.checkForm.bed = '',
                    this.checkForm.balcony = '',
                    this.checkForm.desk = '',
                    this.checkForm.electricity = '',
                    this.checkForm.allSelect = [],
                    this.checkForm.buildId = '',//楼号
                    this.checkForm.roomId = '', //这是选择宿舍
                    this.checkForm.checkScore = "",
                    this.checkTableClick = false
            }

        },
        mounted: function () {
            this.initData();
            this.getRoom();
            this.getBulid();
        },

    }
</script>

<style scoped>
  .firstSytle {
    margin-top: 30px;
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: left;
  }

  .lastLine {
    display:  flex;
    flex-direction:  row;
    justify-content:  flex-end;
    margin:  10px 0 10px 0;
  }

  .el-row {
    margin: 10px 0;
  }

  .el-table {
    text-align: left;
    size: auto;
    width: 150px;
  }

  .check11 {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    border: 1px solid black;
  }

  .check12 {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
  }

  .form11 {
    border-width: 0 1px 1px 1px;
    border-color: black;
    border-style: solid;
  }

  #Check.el-form-item {
    border-width: 0 1px 1px 1px;
    border-color: black;
    border-style: solid;
    margin-bottom: 0;
  }

  #Check.el-form-item /deep/ .el-form-item__label {
    height: 100% !important;
    border-right: 1px solid black !important;
    text-align: center;
  }

  #Check.el-form-item /deep/ .el-form-item__content {
    height: 100%;
  }

  .checkCenter {
    /* margin: auto; */
    width: 100%;
    height: 100%;
  }

  .checkInput {
    height: 100%;
    /* margin: auto; */
    width: 10%;
    border-left: 1px solid black;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .topCenter {
    height: 100%;
    border-width: 0 1px;
    border-style: solid;
    border-color: black;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .score {
    display: flex;
    align-items: center;
    justify-content: center;
  }
</style>
